<?php

use Illuminate\Support\Facades\Route;

use App\Http\Controllers\Api\GoodsController;
use App\Http\Controllers\Api\IndexController;
use App\Http\Controllers\Api\OrderController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\LoginController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/

Route::prefix('api')->group(function () {
    Route::group(['namespace' => 'Api'], function () {
        # ==== 公共模块 ====
        # 发送短信验证码
        Route::post('/send/code', [LoginController::class, 'sendCode']);
        # 账号密码登录
        Route::post('/pass/login', [LoginController::class, 'passLogin']);
        # 手机号登录
        Route::post('/mobile/login', [LoginController::class, 'mobileLogin']);
        Route::post('/index/applyStore', [LoginController::class, 'applyStore']);
        Route::post('/index/imageUpload', [LoginController::class, 'imageUpload']);
        # 获取地址
        Route::get('/index/getArea', [IndexController::class, 'getArea']);
        Route::get('/index/index', [IndexController::class, 'index']);
        Route::get('/index/adList', [LoginController::class, 'adList']);
        Route::get('/login/goodsList', [LoginController::class, 'goodsList']);


        # ==== 商品模块 ====
        # 商品列表
        Route::get('/goods/goodsList', [GoodsController::class, 'goodsList']);
        # 商品分类列表
        Route::get('/goods/goodsCateList', [GoodsController::class, 'goodsCateList']);
        # 商品库存列表
        Route::get('/goods/repertoryList', [GoodsController::class, 'repertoryList']);
        # 商品库存出库
        Route::post('/goods/repertoryOut', [GoodsController::class, 'repertoryOut']);
        # 商品库存变动历史列表
        Route::get('/goods/repertoryLogList', [GoodsController::class, 'repertoryLogList']);
        # 获取单个商品详情
        Route::get('/goods/singleInfo', [IndexController::class, 'getSingleGoodsInfo']);
        # 获取组合商品详情
        Route::get('/goods/multipleInfo', [IndexController::class, 'getMultipleGoodsInfo']);
        # 单品加入购物车
        Route::post('/goods/singleAddCart', [GoodsController::class, 'singleGoodsAddCart']);
        # 组合商品加入购物车
        Route::post('/goods/multipleAddCart', [GoodsController::class, 'multipleGoodsAddCart']);
        # 统计购物车商品数量
        Route::get('/goods/cartCount', [GoodsController::class, 'getCartCount']);


        # ====发货订单 ====
        # 购物车列表列表
        Route::get('/order/shoppingCart', [OrderController::class, 'shoppingCart']);
        #发货订单列表
        Route::get('/order/addShoppingCart', [OrderController::class, 'addShoppingCart']);
        # 购物车更新数量
        Route::post('/order/upShoppingCart', [OrderController::class, 'upShoppingCart']);
        # 删除购物车
        Route::post('/order/delShoppingCart', [OrderController::class, 'delShoppingCart']);
        # 订单提交页
        Route::get('/order/orderSubmit', [OrderController::class, 'orderSubmit']);
        # 动态获取运费
        Route::post('/order/freightAndAmount', [OrderController::class, 'freightAndAmount']);
        # 订单生成
        Route::post('/order/orderMake', [OrderController::class, 'orderMake']);//下单提交
        #发货订单列表
        Route::get('/order/orderList', [OrderController::class, 'orderList']);
        #发货订单详情
        Route::get('/order/orderDetail', [OrderController::class, 'orderDetail']);
        #发货订单详情
        Route::get('/order/orderPdf', [OrderController::class, 'orderPdf']);




        # ==== 用户模块 ====
        # 用户中心
        Route::get('/user/index', [UserController::class, 'index']);
        Route::get('/user/storeInfo', [UserController::class, 'storeInfo']);
        Route::post('/user/storeEdit', [UserController::class, 'storeEdit']);
        # 用户地址列表
        Route::get('/user/myAddressList', [UserController::class, 'myAddressList']);
        # 地址详情
        Route::get('/user/myAddressDetail', [UserController::class, 'myAddressDetail']);
        # 地址编辑
        Route::post('/user/myAddressEdit', [UserController::class, 'myAddressEdit']);
        Route::post('/user/myAddressDel', [UserController::class, 'myAddressDel']);
        # 修改密码
        Route::post('/user/changePassword', [UserController::class, 'changePassword']);
    });
});